#include <iostream>
#include <string>
#include <queue>
class Solution
{
public:
	Solution() {};
	~Solution() {};
	void InitStr(std::string);
	bool IsUserfulBrackets();
private:
	std::string bracketsStr = "";
	bool IsMatch(char a, char b);
};

bool Solution::IsMatch(char a, char b)
{
	if (a == '{'&&b == '}')return true;
	if (a == '['&&b == ']')return true;
	if (a == '('&&b == ')')return true;
	return false;
}
void Solution::InitStr(std::string str)
{
	bracketsStr = str;
}
bool Solution::IsUserfulBrackets()
{
	if (bracketsStr.size() == 1)
		return false;
	std::queue<char>CharQueue;
	for (auto it : bracketsStr)
	{
		if (it=='{'|| it == '[' || it == '(' )
		{
			CharQueue.push(it);
		}
		else if (it == '}' || it == ']' || it == ')') {
			char a = CharQueue.front();
			if (IsMatch(a, it))
				return true;
			else
				return false;
		}
	}
	return false;
}
int main()
{
	std::string bracketsStr("{}(){}[]");
	Solution solution;
	solution.InitStr(bracketsStr);
	std::cout << "ret is :" << solution.IsUserfulBrackets() << std::endl;
}